#ifndef RP2AVIGENERATOR_H
#define RP2AVIGENERATOR_H

#include "Rp2System.h"

// needed headers
#include <comdef.h>
#include <memory.h>
#include <tchar.h>
#include <string.h>
#include <vfw.h>
#pragma comment (lib, "vfw32.lib")

namespace Rp2
{

class AVIGenerator
{
public:
	AVIGenerator(std::string kFileName = "Untitled.avi", int iFrameRate = 60);
	~AVIGenerator();

	bool InitAVIEngine();
	void ReleaseAVIEngine();

	void SetBitmapHeader(LPBITMAPINFOHEADER lpBIH);
	void SetRate(int iFrameRate);
	LPBITMAPINFOHEADER GetBitmapHeader();//returns a pointer to bitmap info	

	// Adds a frame to the movie. 
	// Data has to be compatible with the bitmap description of the movie.
	void AddFrame(BYTE* pBits);
	
protected:
	std::string m_kFileName;
	int			m_iFrameRate;
	long		m_lFrameCounter;
	PAVIFILE	m_pAVIFile;	// file interface pointer
	PAVISTREAM	m_pStream;  // address of the stream interface
	PAVISTREAM	m_pStreamCompressed; // address of the compressed stream
	BITMAPINFOHEADER m_kBIH;

};

}

#endif